#!/bin/sh

# Servidor no qual estao hospedados os servicos
server=localhost

# Verifica se a variavel de ambiente referente ao Java esta devidamente setada
if [ -z "$JAVA_HOME" ]; then
  export JAVA_HOME=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
fi

# Verifica se a variavel de ambiente referente ao Axis2 esta devidamente setada
if [ -z "$AXIS_HOME" ]; then
  export AXIS_HOME=/Users/andregustavo/Doutorado/Bibliotecas/axis2
fi

# Remove callbacks e stubs gerados anteriormente
for service in CreditCardService DatabaseHPService StorageHPService SalesAutomationService DatabaseService StorageService MessagingService
do
   rm "src/client/"$service"Stub.java" "src/client/"$service"CallbackHandler.java"
done

# Geracao dos callbacks e stubs com o Axis2
for service in CreditCardService DatabaseHPService StorageHPService SalesAutomationService DatabaseService StorageService MessagingService
do
   sh $AXIS_HOME/bin/wsdl2java.sh -uri http://$server:8080/axis2/services/$service?wsdl -p client -uw
done
